/// Qualab - 24/11/2011

#include <wink/types.h>

namespace wink
{
    Point::Point()
    {
        x = y = 0;
    }

    Point::Point( int X, int Y )
    {
        x = X, y = Y;
    }

    Point::Point( const POINT& source )
    {
        x = source.x;
        y = source.y;
    }

    Point& Point::operator = ( const POINT& source )
    {
        x = source.x;
        y = source.y;
        return *this;
    }

    Rect::Rect()
    {
        left = top = right = bottom = 0;
    }

    Rect::Rect( int x, int y, SizeType width, SizeType height )
    {
        left    = x;
        top     = y;
        right   = x + width - 1;
        bottom  = y + height - 1;
    }

    Rect::Rect( const Rect& source )
    {
        left    = source.left;
        top     = source.top;
        right   = source.right;
        bottom  = source.bottom;
    }

    Rect& Rect::operator = ( const Rect& source )
    {
        left   = source.left;
        top    = source.top;
        right  = source.right;
        bottom = source.bottom;
        return *this;
    }

    SizeType Rect::Width()  const
    {
        return right - left + 1;
    }

    SizeType Rect::Height() const
    {
        return bottom - top + 1;
    }

    int Rect::Left() const
    {
        return left;
    }

    int Rect::Top() const
    {
        return top;
    }

    int Rect::Right() const
    {
        return right;
    }

    int Rect::Bottom() const
    {
        return bottom;
    }

    void Rect::SetLeft( int value )
    {
        right += value - left;
        left = value;
    }

    void Rect::SetTop( int value )
    {
        bottom += value - top;
        top = value;
    }

    void Rect::SetWidth( SizeType value )
    {
        right = left + value;
    }

    void Rect::SetHeight( SizeType value )
    {
        bottom = top + value;
    }
}
